Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding sails DEX #547

Merged
merged 7 commits into from
Jan 16, 2025
Merged

Adding sails DEX #547

merged 7 commits into from
Jan 16, 2025

Conversation

MedovTimur
Copy link
Contributor

No description provided.

Copy link
Contributor

@LouiseMedova LouiseMedova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Gas runs out during transactions that are not atomic. Critical sections, the handle reply hook, and checking the attached gas amount could be used.
  2. The math is performed simply in integers, which causes quite rough rounding. We could consider using binary math operations (i.e., shifting for multiplication/division).

contracts/dex/app/src/lib.rs Show resolved Hide resolved

// Transfer token A back to the user
let request_a = vft_io::TransferFrom::encode_call(program_id, sender, amount_a);
msg::send_bytes_for_reply(storage.token_a, request_a, 0, 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same here.

  1. The transfer occurs after the state changing
  2. Running out of gas is a critical issue here

contracts/dex/app/src/lib.rs Show resolved Hide resolved
@LouiseMedova LouiseMedova merged commit 699b14c into master Jan 16, 2025
1 check passed
@LouiseMedova LouiseMedova deleted the tm/sails-dex branch January 16, 2025 07:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants